﻿<%@ Page Title="" Language="C#" MasterPageFile="~/masterpagecuatui.Master" AutoEventWireup="true" CodeBehind="NewsTags.aspx.cs" Inherits="SQT.tracnghiem.BaiViet.Tags" %>
<%@ Import Namespace="DataAccess" %>
<%@ Register Src="~/BaiViet/Left_searchmenupage.ascx" TagPrefix="uc1" TagName="Left_searchmenupage" %>
<%@ Register Src="~/BaiViet/Right_newestpost.ascx" TagPrefix="uc1" TagName="Right_newestpost" %>
<%@ Register Src="~/BaiViet/Right_hotestpost.ascx" TagPrefix="uc1" TagName="Right_hotestpost" %>



<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../Scripts/jssor.slider-21.1.5.mini.js"></script>
    <title><%=this.title %> - Tiếng nhật thật dễ</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <%
        var get_tags = (from p in new TblNewsController().FetchAll().Where(x => x.NewsDelete == false && x.NewsActive == true && x.NewsTags.Contains(this.id)) orderby p.NewsDate descending select p);
        int get_page = 0;
        if (get_tags.ToList().Count % 10 != 0)
            get_page = get_tags.ToList().Count / 10 + 1;
        else
            get_page = get_tags.ToList().Count / 10;
         %>
    <div class="page-main-content w3-row">
        <div class="news-page w3-padding">
            <div id="news-main-content" class="w3-row">
                <div id="news-menu" class="w3-col l2">
                    <uc1:Left_searchmenupage runat="server" ID="Left_searchmenupage" />
                </div>
                <div class="w3-col l7 w3-padding-left">
                    <div class="w3-row w3-margin-bottom">
                        <header class="news-cate-header w3-border-teal"><a class="w3-btn w3-teal">TỪ KHÓA</a></header>
                        <div class="w3-row">
                            <%foreach(TblNews tags in get_tags){
                                  string time = DateTime.Parse(tags.NewsDate.ToString()).Day + "/" + DateTime.Parse(tags.NewsDate.ToString()).Month + "/" + DateTime.Parse(tags.NewsDate.ToString()).Year;
                                  %>
                            <div class="news-post w3-margin-top w3-half w3-padding-right w3-center">
                                <a href="../bai-viet/<%=convertToUrl(convertToUnSign(tags.NewsTitle)) %>-<%=tags.NewsId %>">
                                    <img src="/Content/newsdata/avatar/<%=tags.NewsImages %>" /></a>
                                <div class="news-hot-title"><a class="w3-hover-text-teal" href="../bai-viet/<%=convertToUrl(convertToUnSign(tags.NewsTitle))%>-<%=tags.NewsId %>"><%=limitTitle(tags.NewsTitle) %></a></div>
                                <div class="w3-small"><span class="w3-text-grey"><%=time %></span><span> - </span><span class="w3-text-teal"><%=tags.NewsViewed %> lượt xem</span></div>
                            </div>
                            <%} %>
                        </div>
                        <%
                            if(get_page>1){ %>
                        <div class="w3-center w3-margin-top">
                            <ul class="w3-pagination">
                                <%if (this.page > 1)
                                  { %>
                                <li><a href="?page=<%=this.page-1 %>" class="hvr-reveal w3-hover-white"><i class="fa fa-angle-left"></i></a></li>
                                <%} %>
                                <%for (int i = 1; i <= get_page; i++)
                                  { %>
                                <%if (i == this.page)
                                  { %>
                                <li><a class="w3-teal hvr-reveal w3-hover-white" href="javascrit:;"><%=i%></a></li>
                                <%}
                                  else
                                  { %>
                                <li><a href="?page=<%=i %>" class="hvr-reveal w3-hover-white"><%=i%></a></li>
                                <%} %>
                                <%} %>
                                <%if (this.page < get_page)
                                  { %>
                                <li><a href="?page=<%=this.page+1 %>" class="hvr-reveal w3-hover-white"><i class="fa fa-angle-right"></i></a></li>
                                <%} %>
                            </ul>
                        </div>
                        <%} %>
                    </div>
                </div>
                <div class="w3-quarter w3-padding-left">
                    <uc1:Right_newestpost runat="server" ID="Right_newestpost" />
                    <uc1:Right_hotestpost runat="server" ID="Right_hotestpost" />
                </div>
            </div>
        </div>
    </div>
    <script src="../Scripts/javacuatui5.js"></script>
    <script src="../Scripts/slideup_news.js"></script>
</asp:Content>
